LGF_CalcCRC8 (FC / V3.0.1)


Author: Siemens Industry Support

Short description

The CRC calculation is used for error detection at data transmission. The result of a calculation returns a CRC value via the data sent. The receiver detects a faulty transmission due to the unequal CRC value. The function LGF_CalcCRC8 uses 8 bits as the generator polynomial (mask).

Block Interface

LGF_CalcCRC8 (FC)
Byte  initValue Ret_Val  Byte
    
Byte  mask   
    
Array[*] of Byte  array  Array[*] of Byte
       
   

Input parameter

IdentifierData typeDescription
initValueByteStart value with which the calculation is executed.
If there is no need for start value - assign 16#00
maskByteGenerator polynomial with which the calculation is executed.
(Mask / CRC polynomial)

Output parameter

IdentifierData typeDescription
Ret_ValByteCalculated CRC value (return value of the function).

In/Out parameter

IdentifierData typeDescription
arrayArray[*] of ByteData stream for which the CRC value will be calculated.

Functional description

The function calculates the CRC value from a data stream of any size. The data stream is composed of the individual elements of the array at the input/output parameter array. The start value initValue and the generator polynomial mask can be freely selected.

Note
Various online tools are available for calculating the CRC values. The function of the block was tested with the following online tool, since it supports the input parameters mask (Polynomial) and initValue (Initial Value):
http://www.sunshine2k.de/coding/javascript/crc/crc_js.html

Change log

Version & DateChange description
01.00.00Siemens Industry Online Support
03.07.2018First released version
01.00.01Siemens Industry Online Support
17.08.2018Upgrade: TIA V15 Update 2
01.00.02Siemens Industry Online Support
23.11.2018Upgrade: TIA V15.1
01.00.03Simatic Systems Support
09.10.2019Code refactoring, comments added
03.00.00Simatic Systems Support
23.04.2020Set version to V3.0.0, harmonize the version of the whole library
03.00.01Simatic Systems Support
12.11.2020Insert documentation
Assign default start values to optional inputs - `initValue`, `mask`